<%@ page contentType="text/html;charset=UTF-8"%>

<!-- 
	用于嵌入到业务Form表单，但不能与业务表单数据同时保存提交，
	但要注意表单要设置为“enctype="multipart/form-data"”
-->

<!-- 引入附件操作相关的js -->
<script src="${ctx}/common/sysfile/public/attachment-operation.js" type="text/javascript"></script>

<table class="tb_custom">
	<tr>
		<td class="td_header_l" colspan="12">
			<table width="100%"><tr>
				<th width="20"><img src="${ctx}/resources/images/icons/16_16/attach.png"/></th>
				<th align="left">附件管理</th>
			</tr></table>
		</td>
	</tr>
	<!----------------- 上传附件开始 ------------------->
	<tr>
		<td class="td_header_r" width="150">请选择要上传的附件：</td>
		<td class="td_header_l" colspan="11">
			<input type="file" name="attachment" size="80" style="height:95%"/>&nbsp;
			<input type="button" value="上传附件" onclick="addAttachment('${ctx}/sysfile/sys-file!addAttachment.action?entity=${entity}&entityId=${entityId}','${redirectUrl}')"/>
			<input type="button" value="批量上传" onclick="openCenterWindow('${ctx}/resources/components/swfupload/swfupload.jsp?entity=${entity}&entityId=${entityId}', 700, 400)"/>
			<input type="button" value="删除附件" onclick="deleteAttachments('${ctx}/sysfile/sys-file!deleteMoreAttachment.action','${redirectUrl}')"/>
		</td>
	</tr>
	<!----------------- 上传附件结束 ------------------->
</table>
<table class="tb_custom">
	<!----------------- 附件列表表头 ------------------->	
	<tr>
		<th class="td_header" width="2%">
				<input type="checkbox" id="checkall" title="全选" onclick="checkAll('sysFileIds', checkall)"/>
		</th>
		<th class="td_header" width="150">文件编号</th>
		<th class="td_header" width="250">文件名称</th>
		<th class="td_header">文件大小</th>
		<th class="td_header">文件类型</th>
		<th class="td_header">文件格式</th>
		<th class="td_header">创建人</th>
		<th class="td_header" width="130">创建时间</th>
		<th class="td_header">修改人</th>
		<th class="td_header" width="130">修改时间</th>
		<th class="td_header" colspan="3">操作</th>
	</tr>
	<!----------------- 附件列表表头结束 ------------------->
	
	<!----------------- 附件列表记录 ---------------------->
	<s:if test="attachmentList != null">
	<s:iterator value = "attachmentList">
		<tr onmouseover="this.className='tr_selected'" onmouseout="this.className='tr_normal'">
			<td class="td_content" align="center">
				<input type="checkbox" name="sysFileIds" value="${sysFileId}" />
			</td>
			<td class="td_content" align="center">${fileCode}</td>
			<td class="td_content">&nbsp;<a onclick='openAttachment("${ctx}/sysfile/sys-file!readAttachment.action?sysFileId=${sysFileId}","${ctx}/sysfile/sys-file!editOfficeDoc.action?sysFileId=${sysFileId}","${sysFileId}","${fileName}")' style="cursor:hand"><font color="black">${fileName}</font></a></td>
			<td class="td_content">&nbsp;${fileSize}</td>
			<td class="td_content" align="center">${fileType}</td>
			<td class="td_content" align="center">${fileFormat}</td>
			<td class="td_content" align="center">${cmp}</td>
			<td class="td_content" align="center"><s:date name='cdt' format="yyyy-MM-dd HH:mm:ss"/></td>
			<td class="td_content" align="center">${eemp}</td>
			<td class="td_content" align="center"><s:date name='edt' format="yyyy-MM-dd HH:mm:ss"/></td>
			<td class="td_content" width="35" align="center"><a onclick='readAttachment("${ctx}/sysfile/sys-file!readAttachment.action?sysFileId=${sysFileId}","${sysFileId}")' style="cursor:hand"><img src="${ctx}/resources/images/icons/16_16/cart_put.png" border="0" alt="下载附件"></a></td>
			<td class="td_content" width="35" align="center"><a onclick='deleteAttachment("${fileName}","${ctx}/sysfile/sys-file!deleteAttachment.action?sysFileId=${sysFileId}", "${redirectUrl}")' style="cursor:hand"><img src="${ctx}/resources/images/icons/16_16/delete.gif" border="0" alt="删除附件"></a></td>
			<td class="td_content" width="35" align="center"><a onclick='editOfficeDoc("${ctx}/sysfile/sys-file!editOfficeDoc.action?sysFileId=${sysFileId}","${sysFileId}","${fileName}")' style="cursor:hand"><img src="${ctx}/resources/images/icons/16_16/book_edit.png" border="0" alt="在线编辑文档内容"></a></td>
		</tr>
	</s:iterator>
	</s:if>
	<s:else>
		<tr>
			<td class="td_content" colspan="12" align="center">
				<table><tr>
					<td><img src="${ctx}/resources/images/icons/16_16/information.png"/></td>
					<td class="no-record-tip">&nbsp;提示：没有任何相关附件！</td>
				</tr></table>
			</td>
		</tr>
	</s:else>
	<!----------------- 附件列表结束 -------------------->
</table>